package com.tengju.bff.interfaces.covercharge.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @author liang_shi
 * @date 2020/7/16 10:21
 * @description 签署合同来源
 */
@Getter
@AllArgsConstructor
public enum ContractFromEnum {

    /**
     * 自认证企业
     */
    SELF_CERT_COMPANY(1, ContractUserTypeEnum.SINGLE, "自认证企业","企业"),

    SELF_CERT_INDIVIDUAL(2, ContractUserTypeEnum.SINGLE, "自认证个体工商户","个体工商户"),

    LE_TAX_INDIVIDUAL(3, ContractUserTypeEnum.SINGLE, "乐税个体工商户","个体工商户"),


    ;

    private Integer from;

    /**
     * 上上签用户类型 1表示个人 2表示企业（或组织机构）-用户签署合同
     */
    private ContractUserTypeEnum userType;

    private String msg;

    /**简称*/
    private String shortName;

    /**
     * 获取枚举
     */
    public static ContractFromEnum getInstance(Integer from) {
        if (Objects.isNull(from)) {
            return null;
        }
        for (ContractFromEnum fromEnum : ContractFromEnum.values()) {
            if (from.equals(fromEnum.getFrom())) {
                return fromEnum;
            }
        }
        return null;
    }
}
